import low from 'lowdb'
import LocalStorage from 'lowdb/adapters/LocalStorage'

export function getLowDB() {
  const adapter = new LocalStorage('db')
  const db = low(adapter)
  return db
}

export function getNowTime () {
  let date = new Date();
  let addZero = function (val) {
    return val<10? '0'+val: val;
  };
  let LocalTime = date.getFullYear() + "-" +addZero(date.getMonth()+1) + "-" + addZero(date.getDate()) + "-" +
    addZero(date.getHours()) + addZero(date.getMinutes()) +  addZero(date.getSeconds());
  return LocalTime;
}